package routers

import (
	"backSever/controllers/Geek"

	"github.com/gin-gonic/gin"
)

func GeekRoutersInit(r *gin.Engine) {
	DefaultRouter := r.Group("/geek")
	{
		//登录验证
		DefaultRouter.POST("/login", Geek.GeekController{}.Login)

		//无query：id参数->发布文章
		DefaultRouter.POST("/publish", Geek.GeekController{}.PublishOrUpdate)

		//有query：id参数->更新文章
		DefaultRouter.PUT("/publish/:id", Geek.GeekController{}.PublishOrUpdate)

		//上传文件
		DefaultRouter.POST("/upload", Geek.GeekController{}.Upload)

		//获取用户信息
		DefaultRouter.GET("/userinfo", Geek.GeekController{}.GetUserInfo)

		//获取频道数据
		DefaultRouter.GET("/channels", Geek.GeekController{}.GetChannels)

		//获取频道对应文章count件数
		DefaultRouter.GET("/channels/count", Geek.GeekController{}.ChannelIdCount)

		//无query参数:->查询所有文章
		//有query参数:->根据条件查询文章
		DefaultRouter.GET("/articles", Geek.GeekController{}.QueryArticles)

		//根据id删除一条文章
		DefaultRouter.DELETE("/articles/:id", Geek.GeekController{}.DelArticleById)
	}
}
